Page({
  data: {
    balance: 0,
    points: 0,
    coupons: 0,
    transactions: []
  },
  onLoad: function(options) {
    // 加载钱包数据
    this.loadWalletData();
  },
  // 加载钱包数据
  loadWalletData: function() {
    wx.showLoading({
      title: '加载中...',
    });

    // 模拟网络请求
    setTimeout(() => {
      this.setData({
        balance: 268.50,
        points: 1250,
        coupons: 3,
        transactions: [
          {
            id: 1,
            name: '账户充值',
            time: '2023-10-25 09:30',
            amount: 100.00,
            type: 'income', // income or expense
            icon: '/images/gong1.png'
          },
          {
            id: 2,
            name: '专家咨询服务',
            time: '2023-10-20 15:45',
            amount: 88.00,
            type: 'expense',
            icon: '/images/gong2.png'
          },
          {
            id: 3,
            name: '退款',
            time: '2023-10-18 11:20',
            amount: 30.50,
            type: 'income',
            icon: '/images/gong3.png'
          }
        ]
      });
      wx.hideLoading();
    }, 1000);
  },
  // 跳转至充值页面
  goToRecharge: function() {
    wx.navigateTo({
      url: '/pages/recharge/recharge'
    });
  },
  // 跳转至提现页面
  goToWithdraw: function() {
    wx.navigateTo({
      url: '/pages/withdraw/withdraw'
    });
  }
})